 package com.e2e.haiti.infrastructure.surveyor;

import java.io.File;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.Toast;

public class httpPostHelper extends Activity{
		
	public static final String DATABASE_WEBSITE_ADDRESS = "http://epicsprojects.org/haiti_test/haiti_post.php";          
	
	private Context mContext;
	private Cursor structureCursor = null;
	private Utils utilsHelper = null;
	private int structureID = -1;
	
    public httpPostHelper(Context context) {
        mContext = context;
    }
    
    public void postToRemoteDatabase(int structureID_value){
    	
    	// Gets the cursor for the structure that is to be sent
    	structureID = structureID_value;
    	structureCursor = getStructureCursor(structureID);
    	new  httpPostData().execute();    	    	   	
    }
 
    private Cursor getStructureCursor(int structureID){
    	
    	Cursor mCursor;
    	
    	utilsHelper = new Utils(mContext);
        utilsHelper.openDatabase(); 	
    	mCursor = utilsHelper.getStructureCursor(structureID);
    	
    	return mCursor;
    }

    
 private class httpPostData extends AsyncTask<Void, Void, String> {
        
    	private ProgressDialog pdia;
        
    	@Override
        protected void onPreExecute(){ 
                pdia = new ProgressDialog(mContext);
                pdia.setMessage("Uploading Structure Data ...");
                pdia.show();    
        }

        protected String doInBackground(Void... params) {
            	
            // This is executed in the background. POST is happening
            try { 
        	// MPE = multi part entity
           	 
         	     HttpClient httpClient = new DefaultHttpClient();
         	     HttpPost postRequest = new HttpPost(DATABASE_WEBSITE_ADDRESS);
         	     MultipartEntity multipartContent = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
         	     
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX CREATE STRINGS FROM DATABASE XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
         	     
          	    String surveyorName = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_SURVEYOR_NAME));
         	     
         	 // Demographics 
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_CREATED_ON_DATETIME, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_CREATED_ON_DATETIME))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_RECORD_ID, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_RECORD_ID))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTES, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTES))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NAME, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NAME))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_DESC, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_DESC))) );

         	    multipartContent.addPart(SqlHelper.COLUMN_SURVEYOR_NAME, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_SURVEYOR_NAME))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_ENTRY_DESCRIPTOR, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ENTRY_DESCRIPTOR))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_LOCATION, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_LOCATION))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_TENANT_ADDRESS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_TENANT_ADDRESS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_TENANT_NAME, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_TENANT_NAME))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_TENANT_PHONE_NUMBER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_TENANT_PHONE_NUMBER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_OWNERSHIP_STATUS_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_OWNERSHIP_STATUS_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_YEAR_BUILT, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_YEAR_BUILT))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_CONSTRUCTION_DURATION, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_CONSTRUCTION_DURATION))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BUILDER_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BUILDER_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NUMBER_OF_ADULTS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NUMBER_OF_ADULTS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NUMBER_OF_CHILDREN, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NUMBER_OF_CHILDREN))) );
         	          
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_RESIDENCE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_RESIDENCE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_MIXED, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_MIXED))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_SINGLE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_SINGLE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_MULTIPLE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_MULTIPLE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FUNCTION_USAGE_OTHER))) );
         	          
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_OWNERSHIP_STATUS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_OWNERSHIP_STATUS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BUILDER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BUILDER))) );
         	          
//         	    Layout     
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NUMBER_OF_ROOMS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NUMBER_OF_ROOMS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PLAN_DIMENSIONS_WIDTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PLAN_DIMENSIONS_WIDTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PLAN_DIMENSIONS_DEPTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PLAN_DIMENSIONS_DEPTH))) );
         	          
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NUMBER_OF_LEVELS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NUMBER_OF_LEVELS))) );
         	          
//         	    Primary      
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PRIMARY_SYSTEM_CONDITION_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PRIMARY_SYSTEM_CONDITION_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_CONDITION_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_CONDITION_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_THICKNESS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_THICKNESS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_STRUCTURAL_SYSTEM_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_STRUCTURAL_SYSTEM_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FULL_COLUMN_WIDTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FULL_COLUMN_WIDTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FULL_COLUMN_DEPTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FULL_COLUMN_DEPTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_REBAR_CAGE_WIDTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_REBAR_CAGE_WIDTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_REBAR_CAGE_DEPTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_REBAR_CAGE_DEPTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_NUMBER_OF_LONGITUDINAL_BARS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_NUMBER_OF_LONGITUDINAL_BARS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_MINIMUM_TRANSVERSE_SPACING, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_MINIMUM_TRANSVERSE_SPACING))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FULL_BEAM_WIDTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FULL_BEAM_WIDTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FULL_BEAM_DEPTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FULL_BEAM_DEPTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_REBAR_CAGE_WIDTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_REBAR_CAGE_WIDTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_REBAR_CAGE_DEPTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_REBAR_CAGE_DEPTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_NUMBER_OF_LONGITUDINAL_BARS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_NUMBER_OF_LONGITUDINAL_BARS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_MINIMUM_TRANSVERSE_SPACING, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_MINIMUM_TRANSVERSE_SPACING))) );
         	          
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_STONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_STONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_EARTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_EARTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_MATERIAL_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_LOAD_BEARING_WALL_REINFORCEMENT, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_LOAD_BEARING_WALL_REINFORCEMENT))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_LOAD_BEARING_WALL_COLUMNS_PRESENT, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_LOAD_BEARING_WALL_COLUMNS_PRESENT))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_LOAD_BEARING_WALL_RING_BEAM, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_LOAD_BEARING_WALL_RING_BEAM))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_CONCRETE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_CONCRETE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_BAMBOO, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_BAMBOO))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_CONSTRUCTION_MATERIAL_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_CONCRETE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_CONCRETE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_BAMBOO, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_BAMBOO))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_CONSTRUCTION_MATERIAL_OTHER))) );
         	          
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PRIMARY_SYSTEM_CONDITION, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PRIMARY_SYSTEM_CONDITION))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_CONDITION, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_EXTERIOR_WALL_CONDITION))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_STRUCTURAL_SYSTEM, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_STRUCTURAL_SYSTEM))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_LONGITUDINAL_BAR_SIZE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_LONGITUDINAL_BAR_SIZE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_BAR_TEXTURE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_BAR_TEXTURE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_HOOK_DETAIL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_COLUMN_REINFORCEMENT_HOOK_DETAIL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_LONGITUDINAL_BAR_SIZE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_LONGITUDINAL_BAR_SIZE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_BAR_TEXTURE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_BAR_TEXTURE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_HOOK_DETAIL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_BEAM_REINFORCEMENT_HOOK_DETAIL   ))) );
         	          
//         	     Secondary     
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_NOTE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_NOTE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_NOTE))) );
         	          
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_STONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_STONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_EARTH, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_EARTH))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PERMANENT_INTERIOR_PARTITIONS_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_CANVAS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_CANVAS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_SEMI_PERMANENT_INTERIOR_PARTITIONS_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_NONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_NONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_MAT, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_MAT))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_FOOTINGS, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_FOOTINGS))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_SHALLOW_FOUNDATION, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_SHALLOW_FOUNDATION))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_DEEP_FOUNDATION, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_DEEP_FOUNDATION))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_ELEVATED_ON_PILES, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_ELEVATED_ON_PILES))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_SYSTEM_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_NA, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_NA))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_STONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_STONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_CAST_CONCRETE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_CAST_CONCRETE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FOUNDATION_CONSTRUCTION_MATERIAL_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_CONCRETE_SLAB, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_CONCRETE_SLAB))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_FRAMED, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_FRAMED))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_ROOF_TYPE_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_CONCRETE_SLAB_ROOF_PRESENCE_OF_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_CONCRETE_SLAB_ROOF_PRESENCE_OF_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_METAL_FRAMING, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_METAL_FRAMING))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_WOOD_FRAMING, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_WOOD_FRAMING))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_METAL_COVERING, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_METAL_COVERING))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_WOOD_COVERING, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_WOOD_COVERING))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_THATCH_COVERING, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_THATCH_COVERING))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_CANVAS_COVERING, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_CANVAS_COVERING))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_TILES, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_TILES))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_SHINGLES, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FRAMED_ROOF_SHINGLES))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_NA, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_NA))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_STONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_STONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_CAST_CONCRETE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_CAST_CONCRETE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_1_CONSTRUCTION_MATERIAL_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_NA, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_NA))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_STONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_STONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_CAST_CONCRETE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_CAST_CONCRETE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_2_CONSTRUCTION_MATERIAL_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_NA, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_NA))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_STONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_STONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_CAST_CONCRETE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_CAST_CONCRETE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_3_CONSTRUCTION_MATERIAL_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_NA, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_NA))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_STONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_STONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_CAST_CONCRETE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_CAST_CONCRETE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_4_CONSTRUCTION_MATERIAL_OTHER))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_NA, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_NA))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_MASONRY, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_MASONRY))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_STONE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_STONE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_CAST_CONCRETE, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_CAST_CONCRETE))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_WOOD, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_WOOD))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_METAL, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_METAL))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_OTHER, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_FLOOR_5_CONSTRUCTION_MATERIAL_OTHER))) );
         	          
//         	    Exterior Photos  
         	    
         	    String photoFrontPath = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_FRONT));
         	    String photoRightPath = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_RIGHT));
         	    String photoBackPath = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_BACK));
         	    String photoLeftPath = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_LEFT));
         	   
         	    if (!photoFrontPath.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_FRONT, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_FRONT)))) );
         	    }
         	    if (!photoRightPath.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_RIGHT, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_RIGHT)))) );
         	    }
         	    if (!photoBackPath.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_BACK, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_BACK)))) );
         	    }
         	    if (!photoLeftPath.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_LEFT, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_LEFT)))) );
         	    }
         	          
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_FRONT, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_FRONT))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_RIGHT, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_RIGHT))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_BACK, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_BACK))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_LEFT, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_LEFT))) );
         	          
//         	     Extra  Photos
         	    
         	    String photoExtra1Path = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_1));
         	    String photoExtra2Path = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_2));
         	    String photoExtra3Path = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_3));
         	    String photoExtra4Path = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_4));
         	    String photoExtra5Path = structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_5));

         	    if (!photoExtra1Path.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_1, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_1)))) );
         	    }
         	    if (!photoExtra2Path.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_2, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_2)))) );
         	    }
         	    if (!photoExtra3Path.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_3, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_3)))) );
         	    }
         	    if (!photoExtra4Path.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_4, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_4)))) );
         	    }
         	    if (!photoExtra5Path.equals("")){
         	    	multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_5, new FileBody(new File(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_PHOTO_EXTRA_5)))) );
         	    }
         	    
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_1, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_1))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_2, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_2))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_3, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_3))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_4, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_4))) );
         	    multipartContent.addPart(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_5, new StringBody(structureCursor.getString(structureCursor.getColumnIndex(SqlHelper.COLUMN_STRUCTURE_NOTE_EXTRA_5))) );


     // XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX EXECUTE THE POST XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 
         	     postRequest.setEntity(multipartContent);
         	     HttpResponse res = httpClient.execute(postRequest);
         	     
         	     // Checks if the post was successfull
         	     if (res.getStatusLine().getStatusCode() == 200 ){
           	  		String[][] databaseUpdates = {
                			{SqlHelper.COLUMN_STRUCTURE_STATUS,"Uploaded"}
        					}; 
           	  		
                    utilsHelper.openDatabase();
                    utilsHelper.dbHelper.updateStructureEntry(databaseUpdates, structureID );
                    utilsHelper.closeDatabase();
                    
                    // Updates the entries in the database
 		 			Toast.makeText(getApplicationContext(),"Structure Uploaded",Toast.LENGTH_SHORT).show(); 	 			
         	     } else {
  		 			Toast.makeText(getApplicationContext(),"Error Uploading Structure",Toast.LENGTH_SHORT).show(); 	 			
         	     }
         	     res.getEntity().getContent().close();
         	     
         	            	                   	            	
           	} catch (Throwable e) {
        	     // handle exception here
        	  e.printStackTrace();
        	 }
           	
            return null;
        }

        protected void onPostExecute(final String result) {
// REQ 3.5.4.R1 met.  The  dialog progress bar is not removed until a verification from the server has been received postExectue
        	pdia.dismiss(); 

        }
    }	// End of ASync Task
  
} // EOF